package fr.emse.tatiana.commands;





import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.internal.dialogs.ImportExportWizard;
import org.eclipse.ui.internal.dialogs.ImportWizard;
import org.eclipse.ui.wizards.datatransfer.FileSystemImportWizard;

import fr.emse.tatiana.CorpusNavigationView;
import fr.emse.tatiana.corpus.AddFileWizard;
import fr.emse.tatiana.importexport.ImportCorpusWizard;

/**
 * Not yet implemented class intended to be used to import a zipped corpus
 * 
 * @author dyke
 *
 */
public class ImportAction extends Action {
	private final IWorkbenchWindow window;
	private final String navigationId;

	private static ImportAction instance;

	public static ImportAction getInstance() {
		return instance;
	}

	public ImportAction(IWorkbenchWindow window, String label, String navigationId) {
		this.window = window;
		this.navigationId = navigationId;
		setText(label);
		// The id is used to refer to the action in a menu or toolbar
		setId(ICommandIds.CMD_IMPORT);
		// Associate the action with a pre-defined command, to allow key bindings.
		//setActionDefinitionId(ICommandIds.CMD_FILTER);
		setImageDescriptor(fr.emse.tatiana.Activator.getImageDescriptor("/icons/import_wiz.gif"));
		instance = this;
	}


	
	@SuppressWarnings("restriction")
	@Override
	public void run() {
		if(window != null) {
			ImportCorpusWizard wizard = new ImportCorpusWizard();
			wizard.init(window.getWorkbench(), null);
			WizardDialog dialog = new WizardDialog(window.getShell(), wizard);
			dialog.create();
			dialog.open();
		}
	}
}
